var app = require('express')();
var server = require('http').Server(app);
var io = require('socket.io')(server);
 
server.listen(8080);

app.get('/', function (req, res) {
  res.sendfile(__dirname + '/liu.html');
});

io.on('connection', function (socket) {
  socket.emit('serverToclient', {serverMsg: 'client, hello world' });
  socket.on('clientToserver', function (data) {
    console.log(data);
  });
});